﻿@model SysOption
@{
	PageTitle.AddViewTitle("Системные настройки", Url.Action("Index"));
	PageTitle.AddViewTitle(Model.Name);
	PageTitle.AddViewTitle("Изменение");
}

@using (Html.BeginForm(null, null, FormMethod.Post)) {
	@Html.ValidationSummary(true)
	<fieldset class="form">
		<legend>Информация</legend>
		<div>
			@Html.LabelFor(m => m.Name)
			@Model.Name
		</div>
		<div>
			@Html.LabelFor(m => m.ValueType)
			<label for="Name">Тип значения:</label>
			@Model.GetValueTypeFriendlyName()
		</div>
		<div>
			@Html.LabelFor(m => m.Description)
			@Model.Description
		</div>
	</fieldset>
	<fieldset class="form">
		<legend>Значение</legend>
		@if (Model.ValueType == SysOptionType.Boolean)
	    {
			bool val = ViewData.Eval<bool>("Value");
			<label for="ValueTrue" class="inline">@Html.RadioButton("Value", true, val, new { id = "ValueTrue" }) Да</label>
			<label for="ValueFalse" class="inline">@Html.RadioButton("Value", false, !val, new { id = "ValueFalse" }) Нет</label>
		}
		else if (Model.ValueType == SysOptionType.String)
		{
			@Html.TextBox("Value", null, new { @class="wide" })
		}
		else
		{
			@Html.TextBox("Value")
		}
		@Html.ValidationMessage("Value")
	</fieldset>
	<div class="buttons">
		<input type="submit" value="Сохранить" />
		<a href="@ViewBag.CancelUrl">Отменить</a>
	</div>
}